Skip to content

Conversation

@sonalgaud12
Copy link
Contributor

This PR fixes issue #8132

The WithMessageEvents option previously accepted an unexported type (event).
This change exports the type as Event.

@sonalgaud12 sonalgaud12 requested review from a team and dmathieu as code owners November 9, 2025 07:58
@sonalgaud12
Copy link
Contributor Author

Hello @dmathieu , OpenTelemetry Go enums usually prefix constants with the type name (e.g. SpanKindServer, SpanKindClient). So shall I change ReadEvents, WriteEvents to EventRead, EventWrite .

@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.8%. Comparing base (7ff03d6) to head (8cf6f36).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8153   +/-   ##
=====================================
  Coverage   81.8%   81.8%           
=====================================
  Files        194     194           
  Lines      13362   13362           
=====================================
+ Hits       10936   10937    +1     
+ Misses      2029    2027    -2     
- Partials     397     398    +1     
Files with missing lines Coverage Δ
instrumentation/net/http/otelhttp/config.go 83.5% <100.0%> (+1.4%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


func TestEvent(t *testing.T) {
if otelhttp.ReadEvents != 1 {
t.Errorf("ReadEvents = %v, want 1", otelhttp.ReadEvents)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we uniformly adopt the assert.Equal method for assertions.

Additionally, we lack tests for unspecifiedEvent.

t.Errorf("WriteEvents = %v, want 2", otelhttp.WriteEvents)
}

if got := otelhttp.WithMessageEvents(otelhttp.ReadEvents); got == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure what this verifies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This verifies that the exported ReadEvents and WriteEvents values are valid for WithMessageEvents and return a proper non-nil. Is there any improvement I should make or remove this part?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @dmathieu Any good suggestions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subtests would be clearer there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants